package com.caimiao.miao.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.caimiao.miao.library.utils.tip.ToastUtil;

public class PowerReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (TextUtils.equals(action, Intent.ACTION_POWER_CONNECTED)) {
            ToastUtil.show("插入电源");
        } else if (TextUtils.equals(action, Intent.ACTION_POWER_DISCONNECTED)) {
            ToastUtil.show("断开电源");
        } else if (TextUtils.equals(action, Intent.ACTION_BATTERY_LOW)) {
            ToastUtil.show("电源不足");
        } else if (TextUtils.equals(action, Intent.ACTION_BATTERY_OKAY)) {
            ToastUtil.show("电源充足");
        }
    }
}
